#pragma once

#include <IXEdit.h>
#include "XHwndImpl.h"



template <class I>
class CXEditImpl : public CXHwndImpl<I>
{
    typedef CXHwndImpl<I> superclass;

    BEGIN_DEF_SKIN_CLASS(CXEdit, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXEdit,    0)
    END_DEF_SKIN_CLASS();

    IMPL_CONTROL_OBJ(CXEditImpl, superclass, _T("Edit"));

public:
    CXEditImpl();
    virtual ~CXEditImpl();

public:
    // IXHwnd
    virtual DWORD   STDMETHODCALLTYPE   GetHwndFlags();
    virtual BOOL    STDMETHODCALLTYPE   OnCommand(UINT command);
    virtual BOOL    STDMETHODCALLTYPE   OnCtlColor(XCANVAS xCanvas, OUT XBRUSH* pBrush);
    virtual HRESULT STDMETHODCALLTYPE   get_Text(IN BSTR* bstrText);

public:
    // IXEdit
    virtual DWORD   STDMETHODCALLTYPE   get_MaxCount();
    virtual void    STDMETHODCALLTYPE   put_MaxCount(IN DWORD dwCount);

    virtual BOOL    STDMETHODCALLTYPE   get_ReadOnly();
    virtual void    STDMETHODCALLTYPE   put_ReadOnly(IN BOOL bReadOnly);

    virtual HRESULT STDMETHODCALLTYPE   get_HintText(OUT BSTR* pbstrHint);
    virtual void    STDMETHODCALLTYPE   put_HintText(IN LPCTSTR szHint);

    virtual COLORREF STDMETHODCALLTYPE  get_HintTextColor();
    virtual void    STDMETHODCALLTYPE   put_HintTextColor(IN COLORREF clrHint);

    virtual BOOL    STDMETHODCALLTYPE   get_Multiline();
    virtual void    STDMETHODCALLTYPE   put_Multiline(IN BOOL bMultiline);

    virtual BOOL    STDMETHODCALLTYPE   get_AutoHScroll();
    virtual void    STDMETHODCALLTYPE   put_AutoHScroll(IN BOOL bAutoScroll);

    virtual BOOL    STDMETHODCALLTYPE   get_AutoVScroll();
    virtual void    STDMETHODCALLTYPE   put_AutoVScroll(IN BOOL bAutoScroll);

public:
    // IXBaseObj
    virtual void STDMETHODCALLTYPE   OnFinalRelease();

protected:
    // CXEditImpl
    void    HideHintText();
    void    ShowHintText();

protected:
    // CXHwndImpl Callback
    virtual XString GetHwndClassName();

    // CXControlImpl
    virtual HRESULT OnSkinLangChanged();

protected:
    BOOL        m_bShowHintText;
    XString     m_strHintText;
    XString     m_strHintTextResId;
    COLORREF    m_clrHintText;
};


class CXEdit : public CXEditImpl<IXEdit>
{
};
